﻿import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Scanner;

public class Teat {

	public static void main(String[] args) {

		Calendar c = Calendar.getInstance();
		long t1 = c.getTimeInMillis();
		// System.out.println(jin_zhi_16_3("f"));
		// getSuchNum();
		// jiefangcheng();
		numberBreak();
		// bigFlowerNum();

		// swap();
		// cycleNum();

		c = Calendar.getInstance();
		long t2 = c.getTimeInMillis();
		System.out.println(t2 - t1 + "毫秒！");
	}

	public static int getMaxContinuity(String s) {
		int max_1 = 0;
		int max_0 = 0;
		int n_1 = 0; // 当前1连续的次数
		int n_0 = 0; // 当前0连续的次数

		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) == '0') {
				n_0++;
				n_1 = 0;
			} else {
				n_1++;
				n_0 = 0;
			}

			if (n_1 > max_1)
				max_1 = n_1;
			if (n_0 > max_0)
				max_0 = n_0;
		}

		return max_1 > max_0 ? max_1 : max_0;
	}

	private static int getRealValue(char x) {
		if (x >= '0' && x <= '9')
			return x - '0';
		if (x >= 'a' && x <= 'f')
			return x - 'a' + 10;
		if (x >= 'A' && x <= 'F')
			return x - 'A' + 10;
		return 0;
	}

	public static String jin_zhi_16_3(String x) {
		int n = 0; // 累加真值
		for (int i = 0; i < x.length(); i++) {
			n = n * 16 + getRealValue(x.charAt(i)); // 填空
		}

		String t = "";
		for (;;) {
			if (n == 0)
				break;
			t = (n % 3) + t;
			n = n / 3; // 填空
		}

		return t;
	}

	public static void getSuchNum() {
		for (int i = 100; i < 1000; i += 5) {

			int k = i * i;
			if ((k - i) % 1000 == 0) {
				System.out.println(i);
			}

			int j = i + 1;

			k = j * j;
			if ((k - j) % 1000 == 0) {
				System.out.println(j);
			}

		}
	}

	public static void jiefangcheng() {

		HashSet<String> set = new HashSet<String>();

		for (int i = 1; i < 30; i++) {
			for (int j = 1; j < 30; j++) {
				for (int k = 1; k < 30; k++) {
					for (int p = 1; p < 30; p++) {

						if (i != j && j != k && i != k && i != p && j != p
								&& k != p) {

							if (i * i * i + j * j * j == k * k * k + p * p * p) {

								String s = sort4Num(i, j, k, p);
								set.add(s);

							}

						}

					}
				}
			}
		}

		Iterator<String> iter = set.iterator();

		while (iter.hasNext()) {
			System.out.println(iter.next());
		}

	}

	private static String sort4Num(int a, int b, int c, int d) {

		int[] n = { a, b, c, d };
		for (int i = 0; i < 3; i++) {
			for (int j = i + 1; j < 4; j++) {
				if (n[i] > n[j]) {
					int temp = n[i];
					n[i] = n[j];
					n[j] = temp;
				}

			}
		}
		return n[0] + "," + n[1] + "," + n[2] + "," + n[3];

	}

	static int[][][] m = new int[10][15][10];


	public static void numberBreak() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		System.out.println("aa");

		p(n);

		System.out.println("aa");
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				String s = null;
				if (m[i][j][0] != 0) {
					for (int k = 0; k < n; k++) {
						if (m[i][j][k] != 0) {
							if (s != null) {
								s = s + "+" + m[i][j][k];
							} else {
								s = "" + m[i][j][k];
							}
						}
					}
				}
				if (s != null) {

					System.out.print(s + ",");
				}
			}
			System.out.println();
		}

	}

	public static void p(int n) {

		for (int i = 0; i < n; i++) {
			m[i][0][0] = i + 1;
			for (int j = 1; j < n - i; j++) {
				m[i][0][j] = 1;
			}
		}

		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n && m[i][j][0] != 0; j++) {
				int[] buf = new int[10];
				int num = 0;
				for (int k = 0; k < n && m[i][j][k] != 0; k++) {
					buf[k] = m[i][j][k];
					num++;
				}
				

				for (int k = num - 1; k >= 1; k--) {
					if (buf[k] == 0) {
						continue;
					}
					if (buf[k - 1] > buf[k]) {
						if (buf[k] + buf[k + 1] <= buf[k - 1] && buf[k+1]!=0) {
							int[] nbuf = new int[10];
							System.arraycopy(buf, 0, nbuf, 0, 10);
							nbuf[k] = nbuf[k] + nbuf[k + 1];
							int p = 0;
							for (p = k + 2; p < n && nbuf[p] != 0; p++) {
								nbuf[p - 1] = nbuf[p];
							}
							nbuf[p - 1] = 0;
							p = 0;
							for(p = 0 ;p<n && m[i][p][0]!=0;p++) {
								
							}
							for(int q=0 ; q<n && nbuf[q]!=0;q++) {	
								m[i][p][q] = nbuf[q];
							}
							
						} 
					}
				}
			}
		}
	}

	public static void bigFlowerNum() {

	}

	public static void swap() {
		long a = 9;
		long b = 6;

		System.out.println(Integer.toBinaryString((int) a));
		System.out.println(Integer.toBinaryString((int) b));
		a = a ^ b;
		System.out.println(Integer.toBinaryString((int) a));
		System.out.println(Integer.toBinaryString((int) b));
		b = a & b;
		System.out.println(Integer.toBinaryString((int) a));
		System.out.println(Integer.toBinaryString((int) b));
		a = a ^ b;
		System.out.println(Integer.toBinaryString((int) a));
		System.out.println(Integer.toBinaryString((int) b));
		System.out.println(a + "  " + b);

		a = Math.round(Math.pow((double) a, (double) b));

		b = Math.round(Math.pow((double) a, 1 / (double) b));

		a = Math.round((Math.log(a) / Math.log(b)));

		System.out.println(a + "  " + b);

	}

	public static void cycleNum() {

		int[] big = new int[2001];
		int n = 0;
		for (int i = 1; i < 10; i++) {
			for (int j = 0; j <= i; j++) {
				for (int k = 0; k <= j; k++) {
					for (int p = 0; p <= k; p++) {
						for (int q = 0; q <= p; q++) {
							big[n++] = i * 10000 + j * 1000 + k * 100 + p * 10
									+ q;
						}
					}
				}

			}
		}

		int[][] m = new int[2001][20];
		boolean[] t = new boolean[2001];
		int[] buf = new int[20];

		int j = 0;
		for (int i = 0; i < n; i++) {
			if (!t[i]) {
				t[i] = true;
				int a = big[i];
				int b = getNextSmall(big[i]);
				// System.out.println("next small is "+b);

				buf[0] = a - b;
				System.out.println("buf[0]=" + buf[0]);
				int ss = 0;
				while (true) {
					int k = getNextBig(buf[ss]);
					// System.out.println("k= "+k);
					if (k == 0) {
						break;
					}

					int index = Arrays.binarySearch(big, k);

					int kl = getNextSmall(buf[ss]);
					int key = k - kl;
					if (t[index]) {

						// System.out.println("kl = "+kl);
						key = hasNum(buf, key, ss);
						if (key != -1) {
							System.out.println("key=" + key);
							System.arraycopy(buf, key, m[j], 0, ss - key + 1);
							System.out.println("................");
							System.out.println(Arrays.toString(m[j]));
							j++;
							break;
						}

						break;
					}
					t[index] = true;

					buf[++ss] = k - kl;
					System.out.println("buf" + ss + "= " + buf[ss]);

				}

			}

		}
		System.out.println("shuchu");
		for (int i = 0; m[i][0] != 0; i++) {
			for (int k = 0; m[i][k] != 0; k++) {
				System.out.print(m[i][k] + ",");
			}
			System.out.println();
		}

	}

	private static int getNextBig(int num) {
		char[] a = new char[5];
		a[0] = (char) (num / 10000);
		num %= 10000;
		a[1] = (char) (num / 1000);
		num %= 1000;
		a[2] = (char) (num / 100);
		num %= 100;
		a[3] = (char) (num / 10);
		num %= 10;
		a[4] = (char) (num);

		Arrays.sort(a);

		return a[4] * 10000 + a[3] * 1000 + a[2] * 100 + a[1] * 10 + a[0];
	}

	private static int getNextSmall(int num) {
		char[] a = new char[5];
		a[0] = (char) (num / 10000);
		num %= 10000;
		a[1] = (char) (num / 1000);
		num %= 1000;
		a[2] = (char) (num / 100);
		num %= 100;
		a[3] = (char) (num / 10);
		num %= 10;
		a[4] = (char) (num);

		Arrays.sort(a);

		return a[0] * 10000 + a[1] * 1000 + a[2] * 100 + a[3] * 10 + a[4];
	}

	private static int hasNum(int[] m, int k, int length) {
		for (int i = 0; i < length; i++) {
			if (m[i] == k) {
				return i;
			}
		}
		return -1;
	}

}
